/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class Reviewer
    {
    
        private String customerIdField;

        private String nameField;

        private String nicknameField;

        private String locationField;


        /// <summary>
        /// Gets and sets the CustomerId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "CustomerId")]
        public String CustomerId
        {
            get { return this.customerIdField ; }
            set { this.customerIdField= value; }
        }



        /// <summary>
        /// Sets the CustomerId property
        /// </summary>
        /// <param name="customerId">CustomerId property</param>
        /// <returns>this instance</returns>
        public Reviewer WithCustomerId(String customerId)
        {
            this.customerIdField = customerId;
            return this;
        }



        /// <summary>
        /// Checks if CustomerId property is set
        /// </summary>
        /// <returns>true if CustomerId property is set</returns>
        public Boolean IsSetCustomerId()
        {
            return  this.customerIdField != null;

        }


        /// <summary>
        /// Gets and sets the Name property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Name")]
        public String Name
        {
            get { return this.nameField ; }
            set { this.nameField= value; }
        }



        /// <summary>
        /// Sets the Name property
        /// </summary>
        /// <param name="name">Name property</param>
        /// <returns>this instance</returns>
        public Reviewer WithName(String name)
        {
            this.nameField = name;
            return this;
        }



        /// <summary>
        /// Checks if Name property is set
        /// </summary>
        /// <returns>true if Name property is set</returns>
        public Boolean IsSetName()
        {
            return  this.nameField != null;

        }


        /// <summary>
        /// Gets and sets the Nickname property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Nickname")]
        public String Nickname
        {
            get { return this.nicknameField ; }
            set { this.nicknameField= value; }
        }



        /// <summary>
        /// Sets the Nickname property
        /// </summary>
        /// <param name="nickname">Nickname property</param>
        /// <returns>this instance</returns>
        public Reviewer WithNickname(String nickname)
        {
            this.nicknameField = nickname;
            return this;
        }



        /// <summary>
        /// Checks if Nickname property is set
        /// </summary>
        /// <returns>true if Nickname property is set</returns>
        public Boolean IsSetNickname()
        {
            return  this.nicknameField != null;

        }


        /// <summary>
        /// Gets and sets the Location property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Location")]
        public String Location
        {
            get { return this.locationField ; }
            set { this.locationField= value; }
        }



        /// <summary>
        /// Sets the Location property
        /// </summary>
        /// <param name="location">Location property</param>
        /// <returns>this instance</returns>
        public Reviewer WithLocation(String location)
        {
            this.locationField = location;
            return this;
        }



        /// <summary>
        /// Checks if Location property is set
        /// </summary>
        /// <returns>true if Location property is set</returns>
        public Boolean IsSetLocation()
        {
            return  this.locationField != null;

        }




        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method. 
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment() {
            StringBuilder xml = new StringBuilder();
            if (IsSetCustomerId()) {
                xml.Append("<CustomerId>");
                xml.Append(EscapeXML(this.CustomerId));
                xml.Append("</CustomerId>");
            }
            if (IsSetName()) {
                xml.Append("<Name>");
                xml.Append(EscapeXML(this.Name));
                xml.Append("</Name>");
            }
            if (IsSetNickname()) {
                xml.Append("<Nickname>");
                xml.Append(EscapeXML(this.Nickname));
                xml.Append("</Nickname>");
            }
            if (IsSetLocation()) {
                xml.Append("<Location>");
                xml.Append(EscapeXML(this.Location));
                xml.Append("</Location>");
            }
            return xml.ToString();
        }

        /**
         * 
         * Escape XML special characters
         */
        private String EscapeXML(String str) {
            StringBuilder sb = new StringBuilder();
            foreach (Char c in str)
            {
                switch (c) {
                case '&':
                    sb.Append("&amp;");
                    break;
                case '<':
                    sb.Append("&lt;");
                    break;
                case '>':
                    sb.Append("&gt;");
                    break;
                case '\'':
                    sb.Append("&#039;");
                    break;
                case '"':
                    sb.Append("&quot;");
                    break;
                default:
                    sb.Append(c);
                    break;
                }
            }
            return sb.ToString();
        }




    }

}